package sg.edu.nus.iss.stockex;

import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

public class CodeKeyGroupingComparator extends WritableComparator {

	protected CodeKeyGroupingComparator() {
		super(CodeDateKey.class, true);
	}

	@Override
	public int compare(WritableComparable key1, WritableComparable key2) {

		CodeDateKey codeDateKey1 = (CodeDateKey) key1;
		CodeDateKey codeDateKey2 = (CodeDateKey) key2;

		return codeDateKey1.getCode().compareTo(codeDateKey2.getCode());

	}

}